<?php
/**
 * (model) CN-海外仓-中转发货单明细（国内发海外仓）
 */
namespace App\Models\OverSeasIn;

use App\Models\Product\ProductClassify;
use App\Models\Product\ProductSku;
use Illuminate\Database\Eloquent\Model;
class DeliveryDetail extends Model
{
    protected $table = 'os_in_delivery_detail';

    protected $guarded = [];

    public function delivery(){
        return $this->belongsTo(Delivery::class,'delivery_no','delivery_no');
    }

    public function sku(){
        return $this->belongsTo(ProductSku::class,'psku_id');
    }

    public static $_status = [
        1 => '未发货',
        2 => '部分发货',
        3 => '完全发货',
        4 => 'ERROR'
    ];

    public function skuClassify(){
        return $this->hasOneThrough(
            ProductClassify::class,
            ProductSku::class,
            'id',//中间表
            'id',//目标表
            'psku_id',//当前模型
            'classify_id'//中间表
        );
    }
}
